//
//  GHBusinessViewController.m
//  GodHorses
//
//  Created by Mac on 2017/11/14.
//  Copyright © 2017年 stoneobs@icloud.com. All rights reserved.
//

#import "GHBusinessViewController.h"
#import "GHReateTableViewCell.h"
@interface GHBusinessViewController ()

@end

@implementation GHBusinessViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"财富分销";
    [self configSubView];
    // Do any additional setup after loading the view.
}

#pragma mark --subView
- (void)configSubView{
    self.tableView.backgroundColor = GH_backgroundColor;
    UIView * tableHeaderView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, UIScreenWidth, 222)];
    tableHeaderView.backgroundColor = self.tableView.backgroundColor;
    UIImageView * bannerImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, UIScreenWidth, 222)];
    bannerImageView.image = [UIImage imageNamed:@"img_fenxiao_banner"];
    [tableHeaderView addSubview:bannerImageView];
    
    UIView  * whiteView = [[UIView alloc] initWithFrame:CGRectMake(0, bannerImageView.st_bottom + 10, UIScreenWidth, 70)];
    whiteView.backgroundColor = [UIColor whiteColor];
    [tableHeaderView addSubview:whiteView];
    
    STButton * fenxiaoButton = [[STButton alloc] initWithFrame:CGRectMake(10, 10, 120, 17)
                                                     title:@"分销返佣余额"
                                                titleColor:GH_firstTextColor
                                                 titleFont:15
                                              cornerRadius:0
                                           backgroundColor:nil
                                           backgroundImage:nil
                                                     image:[UIImage imageNamed:@"PC_tixianjilu"]];
    fenxiaoButton.titleEdgeInsets = UIEdgeInsetsMake(0, 10, 00, 0);
    [whiteView addSubview:fenxiaoButton];
    
    STLabel * moneyLable = [[STLabel alloc] initWithFrame:CGRectMake(0, fenxiaoButton.st_bottom - 2, 300, 25)
                                                     text:@"￥90"
                                                textColor:GH_redColor
                                                     font:24
                                              isSizetoFit:NO
                                            textAlignment:NSTextAlignmentCenter];
    moneyLable.st_centerX = UIScreenWidth /2;
    [whiteView addSubview:moneyLable];
    
    tableHeaderView.st_height = whiteView.st_bottom;
    self.tableView.tableHeaderView = tableHeaderView;
}
#pragma --mark UITableViewDataSource
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    
    return 3 ;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    
    return 1;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    return 150;
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    
    return 10;
}
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    return 0.01;
}
- (UIView*)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
    return [UIView new];
}
- (UIView*)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
    return [UIView new];
}
- (UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    static NSString * reuseIdentifier =  @"cell";
    GHReateTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:reuseIdentifier];
    if (!cell) {
        cell = [[GHReateTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuseIdentifier];
        
    }
     cell.selectionStyle = UITableViewCellSelectionStyleNone;
    __weak typeof(self) weakSelf =  self;
    [cell.detailButton setClicAction:^(UIButton *sender) {
        [weakSelf onSelectedDetailButtonWithIndexPath:indexPath];
    }];
    return cell;
}
#pragma --mark UITableViewDelegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
    [self.tableView deselectRowAtIndexPath:indexPath animated:NO];
}
#pragma mark --Action Method
- (void)onSelectedDetailButtonWithIndexPath:(NSIndexPath*)indexPath{
    
}
@end
